<?php
if(!isset($argv[1]))
{
	return false;
}

$content  = file_get_contents('http://fanyi.youdao.com/translate?&doctype=json&type=AUTO&i='.trim($argv[1]));
if(!$content)
{
	return false;
}

$content = json_decode($content,true);

if (json_last_error() != JSON_ERROR_NONE) {
            return false;
}
$unit = isset($content['translateResult'][0][0]) ?$content['translateResult'][0][0]:false;
if(!$unit)
{
return false;
}
echo "\r\n\r\n";
echo "    ",$unit['src']," ",'<-------------------->'," ",$unit['tgt'],"    ";
echo "\r\n\r\n";
var_dump($content['translateResult']);


$file = __DIR__.'/temp/fy.temp';
file_put_contents($file,$unit['tgt']);
$fileCommon = "clip < ".$file;
exec($fileCommon);